package org.streets.workflow.engine.entities;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.streets.workflow.engine.ITaskInstance;
import org.streets.workflow.engine.IWorkItem;

/**
 * 
 */
@SuppressWarnings("serial")
@Entity
@Table(name="WF_RT_WORKITEM")
public class WorkItem implements IWorkItem, Serializable {
    @Id
    private String id;
    @Column
    private String actorId;
    @Column(name="item_state")
    private Integer state = null;
    @Column
    private Date createdTime;
    @Column
    private Date claimedTime; //签收时间
    @Column
    private Date endTime;
    @Column
    private String taskId; //added by wangmj 20090922 供springjdbc实现类使用
    @Column
    private String comments;

    private transient ITaskInstance task;
    

    
    public WorkItem() {
    }

    public WorkItem(TaskInstance taskInstance) {
        this.task = taskInstance;
    }


    /**
     * @param state
     * @param createdTime
     * @param signedTm
     * @param endTime
     * @param comments
     * @param taskInstance
     */
    public WorkItem(Integer state, Date createdTime, Date signedTm,
            Date endTime, String comments, TaskInstance taskInstance) {
        this.state = state;
        this.createdTime = createdTime;
        this.claimedTime = signedTm;
        this.endTime = endTime;
        this.comments = comments;
        this.task = taskInstance;
    }

    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }
    
    public String getTaskId(){
        return taskId;
    }

    public void setTaskId(String taskInstanceId){
        this.taskId=taskInstanceId;
    }

    public Integer getState() {
        return this.state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Date getCreatedTime() {
        return this.createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Date getClaimedTime() {
        return this.claimedTime;
    }


    public void setClaimedTime(Date claimedTime) {
        this.claimedTime = claimedTime;
    }

    public Date getEndTime() {
        return this.endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getComments() {
        return this.comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }

    public ITaskInstance getTask() {
        return this.task;
    }

    public void setTask(ITaskInstance taskInstance) {
        this.task = taskInstance;
        this.taskId = taskInstance.getId();//added by wmj2003 20090924
    }

    public String getActorId() {
        return actorId;
    }

    public void setActorId(String actorId) {
        this.actorId = actorId;
    }
}
